//
//  HeadViewWithContentV.m
//  星期一
//
//  Created by 来定MAC on 15/8/4.
//  Copyright (c) 2015年 LD. All rights reserved.
//

#import "HeadViewWithContentV.h"
#import <Masonry.h>

@interface HeadViewWithContentV ()

@property(nonatomic,strong)UIImageView *backImageV;
@property(nonatomic,strong)UILabel *titleWithTime;

@end

@implementation HeadViewWithContentV

- (instancetype)init
{
    self = [super init];
    if (self) {
        
        //[self setBackgroundColor:[UIColor redColor]];
        
        [self addSubview:self.backImageV];
        [self addSubview:self.titleWithTime];
    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.backImageV.translatesAutoresizingMaskIntoConstraints = NO;
    [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-10-[backImage]-10-|" options:0 metrics:nil views:@{@"backImage":self.backImageV}]];
    [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-15-[backImage]-15-|" options:0 metrics:nil views:@{@"backImage":self.backImageV}]];
    
    [self.titleWithTime mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(100);
        make.centerX.equalTo(self.backImageV.mas_centerX);
        make.top.equalTo(self.backImageV.mas_top);
    }];
    
}


- (UIImageView *)backImageV
{
    if (_backImageV == nil) {
        _backImageV = [[UIImageView alloc] init];
        //[_backImageV setBackgroundColor:[UIColor blueColor]];
        [_backImageV setImage:[UIImage imageNamed:@"venus_new_promptbg"]];
    }
    return _backImageV;
}

- (UILabel *)titleWithTime
{
    if (_titleWithTime == nil) {
        _titleWithTime = [[UILabel alloc] init];
        [_titleWithTime setText:@"11:00发布"];
        [_titleWithTime setTextAlignment:NSTextAlignmentCenter];
        [_titleWithTime setFont:[UIFont systemFontOfSize:14]];
        //[_titleWithTime setBackgroundColor:[UIColor greenColor]];
    }
    return _titleWithTime;
}

@end
